package com.shijie.controller.erp;

import com.shijie.service.SignsService;
import com.shijie.domain.entity.Signs;
import com.shijie.core.Result;
import com.shijie.core.ResultGenerator;
import com.shijie.core.annotation.RequiresPermissions;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

import java.util.List;

/*
 *  @author: smart boy
 *  @date: 2018-08-06
 */
@RestController
@RequestMapping("/erp/signs")
public class SignsController {

    @Resource
	private SignsService signsService;

    @RequiresPermissions(value={"sign:list"})
	@GetMapping
    public Result list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer pageSize,@RequestParam(required=false) Integer actId) {
        PageHelper.startPage(page, pageSize);
        List<Signs> list = signsService.selectSignsByActivityId(actId);
        PageInfo<Signs> pageInfo = new PageInfo<>(list);
        return ResultGenerator.success(pageInfo);
	}
}

